package dao.oc_if_evaluate;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import entitybean.oc_depthlist_pla.EntityBeanOc_Depthlist_Pla;
import entitybean.oc_if_evaluate.EntityBeanOc_If_Evaluate;

public class DaoImpl_Oc_If_Evaluate extends HibernateDaoSupport implements Dao_Oc_If_Evaluate{

	public void Delete_Oc_Evaluate(String id,String check,Date passdate) {
		List<EntityBeanOc_If_Evaluate> list=this.getHibernateTemplate().find("from EntityBeanOc_If_Evaluate where   id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBeanOc_If_Evaluate e=list.get(i);
			e.setDel(check);
			e.setPass_time(passdate);
			this.getHibernateTemplate().update(e);
			
		}
		
	}

	public List<EntityBeanOc_If_Evaluate> Find_EntityBeanOc_If_Evaluate() {
		List<EntityBeanOc_If_Evaluate> list=new ArrayList<EntityBeanOc_If_Evaluate>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_If_Evaluate where del='OFF' ");
		return list;
	}

	public void Insert_Oc_Evaluate(EntityBeanOc_If_Evaluate e) {
		this.getHibernateTemplate().save(e);
		
	}

	public void Update_Oc_Evaluate(EntityBeanOc_If_Evaluate e) {
		this.getHibernateTemplate().update(e);
		
	}

	public EntityBeanOc_If_Evaluate Find_EntityBeanOc_If_Evaluate(Integer id) {
		EntityBeanOc_If_Evaluate e=new EntityBeanOc_If_Evaluate();
		List<EntityBeanOc_If_Evaluate> list=this.getHibernateTemplate().find("from EntityBeanOc_If_Evaluate where id="+id);
		if(list.size()>0)
		{
			e=list.get(0);
		}
		return e;
	}

	public List<EntityBeanOc_If_Evaluate> Find_EntityBeanOc_If_Evaluate(
			String del, Integer userid) {
		List<EntityBeanOc_If_Evaluate> list=new ArrayList<EntityBeanOc_If_Evaluate>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_If_Evaluate where del='"+del+"' and pass_time>= sysdate and oc_user_name_id='"+userid+"'");
		return list;
	}

	public List<EntityBeanOc_If_Evaluate> Find_EntityBeanOc_If_Evaluate_Del(
			String del, Integer userid) {
		List<EntityBeanOc_If_Evaluate> list=new ArrayList<EntityBeanOc_If_Evaluate>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_If_Evaluate where del='"+del+"' and oc_user_name_id='"+userid+"'");
		return list;
	}

}
